What is the following number if written out the usual way: 1.9343E+03
1934.3
Consider writing the value 1/3 out in decimal notation:
0.333333333333333333
The result keeps going, and going.
There is no limit to the number of 3's required.
With the float
data type, there are only 32 bits,
not enough bits to represent an unlimited number of 3's.
The data type float
has 23 bits of precision.
(The remaining bits of the 32 bits are used to indicate the
size of the number.)
This is equivalent to only about 7 decimal places.
The number of places of precision for float
is the same no matter what the
size of the number.
Data type float
can represent numbers as big as about
3.4E+38.
But the precision of these large numbers will also be
about 7 decimal digits.
(For more on these topics, consult a physics or chemistry book.)
Remember this: data type float
has about the
range and precision of a cheap electronic calculator.
This is usually not sufficient.